package cn.hiapi.shopkeeper.service.activity;

import cn.hiapi.basic.ResUtils;
import cn.hiapi.basic.jpa.pageable.QueryWrapper;
import cn.hiapi.basic.service.AbsBasicService;
import cn.hiapi.shopkeeper.entity.activity.ActivityVoteItem;
import cn.hiapi.shopkeeper.jpa.activity.ActivityVoteItemJpa;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author AdinZ
 * @date 2023/2/3 1:25
 */
@Service
public class ActivityVoteItemService extends AbsBasicService<ActivityVoteItemJpa, ActivityVoteItem, Long> {
    @Transactional
    public long deleteByAid(long aid) {
        return ResUtils.getDefault(this.repository.deleteByAid(aid));
    }

    public List<ActivityVoteItem> findByAid(long aid) {
        return this.findList(new QueryWrapper().eq("aid",aid));
    }
}
